#ifndef __UTILS_HPP__
#define __UTILS_HPP__

#include <vector>
#include <iterator>

template <typename T>
T ArrayHas(std::vector<T> const &vec, T const obj)
{
    for (auto iter = vec.begin(); iter != vec.end(); iter++)
    {
        if ((*iter) == obj)
        {
            return (*iter);
        }
    }
    return 0;
}
template <typename T>
size_t ArrayFindIndex(std::vector<T> const &vec, T const obj)
{
    size_t i = 0;
    for (auto iter = vec.begin(); iter != vec.end(); iter++)
    {
        if ((*iter) == obj)
        {
            return i;
        }
        i++;
    }
    return -1;
}

template <typename T>
void ArrayRemove(std::vector<T> &vec, T const obj)
{
    size_t i = 0;
    for (auto iter = vec.begin(); iter != vec.end();)
    {
        if ((*iter) == obj)
        {
            iter = vec.erase(iter);
            return;
        }
        else
        {
            iter++;
        }
    }
}

#endif //__UTILS_HPP__